<style>
.weui_cell_bd {
    padding: 0;
	min-height:1.6rem;
	line-height:1.6rem;
}
.weui_cell_hd {min-width:3.7rem;padding: 0 4px;}
.weui_input {padding:0}
</style>
<style>
.fui-goods-item .image {
    height: 7rem;
    width: 10rem;
}
.fui-goods-group {
    padding:0.3rem
}
.timer {
    font-size: .6rem;
    height: .95rem;
    color: #ef4f4f;
}
.timer span {
    display: inline-block;
    background:#582e19;
    color:#fff;
    width:.9rem;height:.9rem;
    border-radius: .1rem;
    line-height:.9rem;
    font-size:.5rem; text-align: center;
}
.radius .jy-group {border-radius:0.5rem;margin:0.35rem 0.5rem}
.radius .jy-group .fui-cell-group{border-radius:0.5rem;margin-top:0}
.bgfff .jy-group {background: #fff}
.weui_cell {
    padding: 0.5rem 0.35rem;
}
.weui_selectpcd{padding:0.3rem 0}
</style>
<div class='fui-page fui-page-current page-commission-register'>
	<div class="jy2-headertopbg" style="height:2.2rem">
		<div class="fui-header" style="background:none">
			<div class="fui-header-left">
				<a class="back" style="color:#fff" href="javascript:" ng-click="access_json('jy_newcar/member.index/')"></a>
			</div>
			<div class="title bold" style="font-size:1rem;color:#fff">{{page.title}}</div>
		</div>
	</div>
	<img style="width:100%;position: relative" ng-src="{{tomedia(pagedata.setting.a_regbg) || '../addons/jy_weishop/resource/images/agent-top.jpg'}}" />
	<div ng-if="pagedata.member.stop==1" class='fui-content'>
        <div  class='content-empty' >
            <i class='icon icon-info text-danger'></i>
            <br/><span class="text-danger">禁止访问，请联系客服！</span>
        </div>
	</div>
	<div ng-if="pagedata.member.stop !=1">
	<div class='fui-content radius' ng-if="!pagedata.apply && !pagedata.can_apply">
			<div  class='fui-list-group'>
				<div class='fui-list-group-title'><i class="icon icon-lights"></i> 友情提醒</div>
				<div class='fui-list'>
					<div ng-if="pagedata.pluginset.area_num>0" class='fui-list-inner'>
						<div class='text'>卖车{{pagedata.pluginset.area_num}}台可申请代理，
							才可申请成为<span class="text-danger text-bold">【经销商】</span>！</div>
					</div>
				</div>
			</div>
	</div>
	<div ng-if="pagedata.apply && !pagedata.applyagain" class='fui-content'>
		<div ng-if="pagedata.applystatus==0" class='content-info' >
            <i class='icon icon-clock'></i>
            <br/><span class="">谢谢您的支持，请等待审核！</span>
			<br/><a class="btn btn-danger" href="javascript:;" ng-click="access_json('jy_newcar/index/')">前往首页</a>
        </div>
		<div ng-if="pagedata.applystatus==1 && pagedata.member.is_area!=1" class='content-info' >
            <i class='icon icon-clock'></i>
            <br/><span class="">您的代理商身份已经清空！无法再申请代理商！</span>
			<br/><a class="btn btn-danger" href="javascript:;" ng-click="access_json('jy_newcar/index/')">前往首页</a>
        </div>
		<div ng-if="pagedata.member.is_area==1" class='content-info' >
            <i class='icon icon-clock'></i>
            <br/><span class="">恭喜您，您的代理申请已审核通过！</span>
            <br/><a class="btn btn-danger" href="javascript:;" ng-click="access_json('jy_newcar/area.index/')">前往代理中心</a>
        </div>
		<div ng-if="pagedata.member.is_area==2 || pagedata.applystatus==2" class='content-info' >
            <i class='icon icon-clock'></i>
            <br/><span class="">非常抱歉，您的代理申请被管理员拒绝！</span>
			<br/><span class="">未审核通过原因：</span>
			<br/><span class="subtitle">{{pagedata.apply.remark || '无'}}</span>
            <br/><a class="btn btn-danger" href="javascript:;" ng-click="pagedata.applyagain=1">重新申请</a>
        </div>
	</div>
    <div ng-if="(!pagedata.apply && pagedata.can_apply) || pagedata.applyagain" class='fui-content'>
        <div class="weui_cells weui_cells_form" style='margin-top:0'>
            <div class="fui-cell-title"style="padding:0.5rem 0.2rem">
                欢迎加入<span class='text-danger'>经销商</span>，请填写申请信息
            </div>
			<div class='weui_cell'>
				<div class='weui_cell_hd must'>公司名称</div>
				<div class='weui_cell_bd weui_cell_primary'><input type="text" class='weui_input' ng-model="pagedata.item.title" placeholder="请填写公司名称"/></div>
			</div>
            <div class='weui_cell'>
                <div class='weui_cell_hd must'>联系人</div>
                <div class='weui_cell_bd weui_cell_primary'><input type="text" class='weui_input' ng-model="pagedata.item.realname" placeholder="请填写联系人" /></div>
            </div>
            <div class='weui_cell'>
                <div class='weui_cell_hd must'>手机号</div>
                <div class='weui_cell_bd weui_cell_primary'><input type="tel" class='weui_input' ng-model="pagedata.item.mobile" placeholder="请填写手机号码方便联系" /></div>
            </div>
			<div class='weui_cell'>
                <div class='weui_cell_hd must'>公司营业执照</div>
                <div class="weui_cell_bd weui_cell_primary">
					<ul ng-if="pagedata.item.codeimg" class="weui_uploader_files">
                          <li class="weui_uploader_file" style="width: 2.5rem;height:2.5rem;background-image:url({{tomedia(pagedata.item.codeimg)}})"></li>
                    </ul>
                    <div ng-if="!pagedata.item.codeimg" class="weui_uploader_input_wrp">
                         <input class="weui_uploader_input" style="width: 2.5rem;height:2.5rem" ng-click="up_file(pagedata.item,'codeimg','image')" multiple="">
                    </div>
                </div>
            </div>
			<div class='weui_cell'>
                <div class='weui_cell_hd must'>公司地址</div>
                <div class='weui_cell_bd weui_cell_primary'><input type="text" class='weui_input' ng-model="pagedata.item.address" placeholder="请填写公司地址" /></div>
            </div>
		</div>
		<div class="weui_cells_title">代理地区</div>
			<div class="weui_cells">
				<!--<div class="weui_cell">
					 <div class="weui_cell_hd">选择坐标</div>
				 </div>
				 <div class="weui_cell">
					 <div class="weui_cell_bd weui_cell_primary">
						<input type="text" ng-model="pagedata.item.addressinfo.lat_lng.lng" placeholder="经度"  class="form-control"/>
					 </div>
					 <div class="weui_cell_bd weui_cell_primary" style="margin-left:0.5rem">
						<input type="text" ng-model="pagedata.item.addressinfo.lat_lng.lat" placeholder="纬度"  class="form-control"/>
					 </div>
					 <div class="weui_cell_bd weui_cell_primary" style="margin-left:0.5rem">
						<a ng-click="tool.choose_location(pagedata.item.addressinfo,'lat_lng','lat_lng')" class="btn btn-default btn-default-o btn-sm" type="button">选择坐标</a>
					 </div>
				 </div>-->
				<div class="weui_cell weui_cell_select">
					<div class="weui_cell_bd weui_cell_primary">
						<select class="weui_selectpcd" ng-model="pagedata.item.pcd.province"  ng-change="pagedata.item.pcd.city=undefined;pagedata.item.pcd.district=undefined;pagedata.item.pcd.street=undefined">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.areas" ng-selected="pagedata.item.pcd.province==value"  value="{{value}}">{{value}}</option>
						</select>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<select class="weui_selectpcd" ng-model="pagedata.item.pcd.city" ng-change="pagedata.item.pcd.district=undefined;pagedata.item.pcd.street=undefined">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.areas[pagedata.item.pcd.province]" ng-selected="pagedata.item.pcd.city==value" value="{{value}}">{{value}}</option>
						</select>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<select class="weui_selectpcd" ng-model="pagedata.item.pcd.district" ng-change="pagedata.item.pcd.street=undefined">
							<option value="" selected="selected">区县</option>
							<option ng-repeat="(value,data) in pagedata.areas[pagedata.item.pcd.province][pagedata.item.pcd.city]" ng-selected="pagedata.item.pcd.district==value" value="{{value}}">{{value}}</option>
						</select>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<select class="weui_selectpcd" ng-model="pagedata.item.pcd.street">
							<option value="" selected="selected">街道</option>
							<option ng-repeat="value in pagedata.areas[pagedata.item.pcd.province][pagedata.item.pcd.city][pagedata.item.pcd.district]" ng-selected="pagedata.item.pcd.street==value" value="{{value}}">{{value}}</option>
						</select>
					</div>
				</div>
			</div>
        <div class="fui-cell-group">
                <div class="fui-cell small ">
                    <div class="fui-cell-info">
                        <label class="checkbox-inline">
                            <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger" ng-checked="pagedata.item.agree==1" ng-model="pagedata.item.agree" /> 我已经阅读并同意<a id="btn-apply" ng-click="pagedata.show_content=true" style="color:#337ab7;">【经销商代理协议】</a>。
                        </label>

                    </div>
                </div>

        </div>
        <div class='btn btn-danger block btn-submit' style="margin-top:2rem" ng-click="post(pagedata.item,'/area.apply/apply/')">申请成为经销商</div>
	</div>
	</div>
	<div ng-if="pagedata.show_content" class="popup">
		<div class="popup-body">
			<div class="popup-center">
				<i class="closed icon icon-cuowu" ng-click="pagedata.show_content=false"></i>
				<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
						<div class="title bold" style="font-size:0.8rem">{{pagedata.setting.a_applytitle || '客户隐私协议'}} / <small>Read Ggree</small></div>
						<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.setting.a_applycontent)">
						</div>
				</div>
				<div class="modal-footer">
					<div ng-click="pagedata.show_content=false;pagedata.item.agree=1;" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
if(!scope.main.pcd){
window.scope.location(function(re){
	var pcd = scope.pagedata.item.pcd
	scope.main.lat_lng=res.lat_lng;
	scope.main.pcd=res.addressComponents;
	if(!pcd || pcd ==''){
		scope.pagedata.item.pcd.province = re.addressComponents.province
		scope.pagedata.item.pcd.city = re.addressComponents.city
		scope.pagedata.item.pcd.district = re.addressComponents.district
		scope.$evalAsync();
	}
});
}else{
scope.pagedata.item.pcd=scope.main.pcd
}
scope.pagedata.getprovince=function(){
	scope.get('core/member.set/getprovince/',function(res){
		scope.pagedata.areas=res.province;
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
</script>